<!--#
layout("/layouts/platform.html"){
#-->
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/platform/shop/adv/position" id="goBack" data-pjax><i class="ti-angle-left"></i>${msg['globals.button.back']}</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="editForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/shop/adv/position/editDo" method="post">
                <input name="id" type="hidden" value="${obj.id}">
                <div class="row mb10 mt10">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label for="code" class="col-sm-2 control-label">${msg['shop.adv.position.column.code']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="code" class="form-control" name="code" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.code']}" value="${obj.code}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">${msg['shop.adv.position.column.name']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="name" class="form-control" name="name" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.name']}" value="${obj.name}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="note" class="col-sm-2 control-label">${msg['shop.adv.position.column.note']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="note" class="form-control" name="note" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.note']}" value="${obj.note}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="type" class="col-sm-2 control-label">${msg['shop.adv.position.column.type']}</label>
                            <div class="col-sm-8">
                                <!--<input type="text" id="type" class="form-control" name="type" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.type']}" value="${obj.type}" >-->
                                <select id="type" name="type" class="form-control">
                                    <option value="0" <!--#if(obj.type==0){#-->selected<!--#}#-->>文字</option>>
                                    <option value="1" <!--#if(obj.type==1){#-->selected<!--#}#-->>图片</option>
                                    <option value="2" <!--#if(obj.type==2){#-->selected<!--#}#-->>幻灯片</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="display" class="col-sm-2 control-label">${msg['shop.adv.position.column.display']}</label>
                            <div class="col-sm-8">
                               <!-- <input type="text" id="display" class="form-control" name="display" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.display']}" value="${obj.display}" >-->
                                <select id="display" name="display" class="form-control">
                                    <option value="0" <!--#if(obj.display==0){#-->selected<!--#}#-->>幻灯片</option>>
                                    <option value="1" <!--#if(obj.display==1){#-->selected<!--#}#-->>多广告展示</option>
                                    <option value="2" <!--#if(obj.display==2){#-->selected<!--#}#-->>单广告展示</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="width" class="col-sm-2 control-label">${msg['shop.adv.position.column.width']}</label>
                            <div class="col-sm-8">
                                <input type="number" id="width" class="form-control" name="width" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.width']}" value="${obj.width}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="height" class="col-sm-2 control-label">${msg['shop.adv.position.column.height']}</label>
                            <div class="col-sm-8">
                                <input type="number" id="height" class="form-control" name="height" data-parsley-required="true"
                                       placeholder="${msg['shop.adv.position.column.height']}" value="${obj.height}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="disabled" class="col-sm-2 control-label">${msg['shop.adv.position.column.disabled']}</label>
                            <div class="col-sm-8 switcha">
                                <div class="mr15">
                                    <input type="checkbox" id="disabled" name="disabled" class="js-switch-blue"  <!--#if(obj.disabled){#-->checked<!--#}#-->>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="${msg['globals.button.submit.tip']}">${msg['globals.button.submit']}</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>

    </div>
</div>
<script language="JavaScript">
    $(document).ready(function () {
        myForm.init();
        $('#editForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goBack").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>
<!--#}#-->